package fantasyfootball.data.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 * Class: 605.441 
 * Group: Richard Koretke, Kay Jantharasorn, Israel Rivera.
 * 
 * @author Israel Rivera
 * 
 */
@Entity(name="NFLDefensiveStats")
public class NFLDefensiveStats implements Serializable {
	
	private static final long serialVersionUID = 2012274773338643784L;
	
	private Integer defensiveStatID;
	private Integer week;
	private NFLPlayer nflPlayer;
	private Integer sacks;
	private Integer defensiveInterceptions;
	private Integer defensiveFumbles;
	private Integer defensiveTD;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="DefensiveStatID", nullable=false)
	public Integer getDefensiveStatID() {
		return defensiveStatID;
	}

	public void setDefensiveStatID(Integer defensiveStatID) {
		this.defensiveStatID = defensiveStatID;
	}

	@Column(name="Week", nullable=true)
	public Integer getWeek() {
		return week;
	}
	
	public void setWeek(Integer week) {
		this.week = week;
	}

	@JoinColumn(name="PlayerID", nullable=false)
	@ManyToOne(fetch=FetchType.LAZY, optional=false)
	public NFLPlayer getNflPlayer() {
		return nflPlayer;
	}
	
	public void setNflPlayer(NFLPlayer nflPlayer) {
		this.nflPlayer = nflPlayer;
	}
	
	@Column(name="Sacks", nullable=true)
	public Integer getSacks() {
		return sacks;
	}
	
	public void setSacks(Integer sacks) {
		this.sacks = sacks;
	}
	
	@Column(name="DefensiveInterceptions", nullable=true)
	public Integer getDefensiveInterceptions() {
		return defensiveInterceptions;
	}
	
	public void setDefensiveInterceptions(Integer defensiveInterceptions) {
		this.defensiveInterceptions = defensiveInterceptions;
	}
	
	@Column(name="DefensiveFumbles", nullable=true)
	public Integer getDefensiveFumbles() {
		return defensiveFumbles;
	}
	
	public void setDefensiveFumbles(Integer defensiveFumbles) {
		this.defensiveFumbles = defensiveFumbles;
	}
	
	@Column(name="DefensiveTD", nullable=true)
	public Integer getDefensiveTD() {
		return defensiveTD;
	}
	
	public void setDefensiveTD(Integer defensiveTD) {
		this.defensiveTD = defensiveTD;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((defensiveStatID == null) ? 0 : defensiveStatID.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		NFLDefensiveStats other = (NFLDefensiveStats) obj;
		if (defensiveStatID == null) {
			if (other.defensiveStatID != null)
				return false;
		} else if (!defensiveStatID.equals(other.defensiveStatID))
			return false;
		return true;
	}

}